home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / RLaB / doc / p3.r < prev    next >
Text File  |  1994-04-25  |  430b  |  22 lines

  1. t = (0:10:.05)';
  2. x = exp (-0.5*t) .* (cos (2*pi*3*t) + sin (2*pi*7*t));
  3. X = fft (x);
  4. rfile faxis
  5. freq = faxis (X, .05, 3);
  6. mag = abs (X);
  7. rfile angle
  8. phase = angle (X);
  9. pstart (1,2,"xwin");
  10.  
  11. ptitle ("Magnitude of FFT")
  12. xlabel ("Frequency (Hertz)");
  13. plwid(6);
  14. plot ([freq,mag]);
  15.  
  16. ptitle ("Angle (atan2(imag/real)) of FFT")
  17. xlabel ("Frequency (Hertz)");
  18. ylabel ("Angle (radians)");
  19. plwid(6);
  20. plot ([freq,phase]);
  21. plprint ("p3.ps");
  22.